package com.hsu.apibackend.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hsu.apibackend.mapper.RechargeActivityMapper;
import com.hsu.apibackend.model.entity.RechargeActivity;
import com.hsu.apibackend.service.RechargeActivityService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author Hsu琛君珩
 * @Date 2024-09-09
 * @Description 充值活动服务实现类，处理充值活动的业务逻辑
 * @Version v1.0.0
 */
@Service
public class RechargeActivityServiceImpl extends ServiceImpl<RechargeActivityMapper, RechargeActivity> implements RechargeActivityService {

    /**
     * 根据订单号查询充值活动列表
     *
     * @param orderNo 订单号
     * @return 充值活动列表
     */
    @Override
    public List<RechargeActivity> getRechargeActivityByOrderNo(String orderNo) {
        // 使用LambdaQueryWrapper根据订单号查询充值活动记录
        LambdaQueryWrapper<RechargeActivity> activityLambdaQueryWrapper = new LambdaQueryWrapper<>();
        activityLambdaQueryWrapper.eq(RechargeActivity::getOrderNo, orderNo);
        return this.list(activityLambdaQueryWrapper);
    }
}
